<%@ page import="bean.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: liuchangling
  Date: 2021/5/30
  Time: 4:49 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <title>查询结果</title>
</head>
<style>
    td, th {
        text-align: center;
    }
</style>
<body style="padding: 50px;">
<table class="table table-responsive">
    <thead>
    <tr>
        <th>工号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>出生日期</th>
        <th>邮箱</th>
        <th>备注</th>
    </tr>
    </thead>
    <tbody>
    <%
        List<User> list = (List<User>) session.getAttribute("result");
        for (int i = 0; i < list.size(); i++) {
            User user = list.get(i);
            if (user.getSex().equals("male")) {
                user.setSex("男");
            } else if (user.getSex().equals("female")) {
                user.setSex("女");
            }
            if (i % 2 == 0) {

    %>
    <tr class="info">
        <td><%=user.getSno()%>
        </td>
        <td><%=user.getName()%>
        </td>
        <td><%=user.getSex()%>
        </td>
        <td><%=user.getBirthday()%>
        </td>
        <td><%=user.getMail()%>
        </td>
        <td><%=user.getRemark()%>
        </td>
    </tr>
    <%
    } else {
    %>
    <tr class="warning">
        <td><%=user.getSno()%>
        </td>
        <td><%=user.getName()%>
        </td>
        <td><%=user.getSex()%>
        </td>
        <td><%=user.getBirthday()%>
        </td>
        <td><%=user.getMail()%>
        </td>
        <td><%=user.getRemark()%>
        </td>
    </tr>

    <%
            }
        }
    %>
    </tbody>
</table>

</body>
</html>
